package com.bootdo.system.controller;

import com.bootdo.system.domain.DayLogVO;
import com.bootdo.system.service.FrontlogService;
import com.bootdo.system.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

@ResponseBody
@Controller
public class LogController extends  BaseController{

    @Autowired
    private FrontlogService frontlogService;


    @GetMapping("/log")
    public R logPage(HttpServletRequest request) {

        //得到日期的list
        List<String> dates = frontlogService.getUserDates(getUserId(request));

        List<DayLogVO> dayLogVOS = frontlogService.getdaylog(getUserId(request),dates);

        return R.ok().put("dayLogVOS",dayLogVOS);
    }
}
